package com.lwx.suanfa.rsa;

import java.sql.BatchUpdateException;

public class RSAMain {

    /**
     * @author liangwenxin
     * @throws Exception 
     */
    public static void main(String[] args) throws Exception {
//        byte[] encrypt = RsaUtil.encrypt(RsaUtil.privateKey, "abc梁".getBytes());
//        System.out.println(new String(encrypt, "utf-8"));
//        System.out.println(new String(RsaUtil.decrypt(RsaUtil.publicKey, encrypt)));
        
        String content = "";
        for(int i = 0; i < 100; i++){
            content += "a";
        }
        
        System.out.println(RsaUtil.encrypt(RsaUtil.publicKey, content.getBytes()));
        String sign = RSASignature.sign(content, RsaUtil.privateKeyStr);
        System.out.println(Base64Util.encode(sign.getBytes()));
        System.out.println(RSASignature.doCheck(content, sign, RsaUtil.publicKeyStr));
    }

}
